<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>全部订单</title>

    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
</head>
<body>
<div class="layui-panel" style="padding: 8px;">
    <fieldset class="layui-elem-field layui-border-green">
        <legend>搜索信息</legend>
        <form class="layui-form layui-form-pane" style="margin: 20px;">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">订单编号</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" type="text" name="name" autocomplete="off" />
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <a class="layui-btn layui-btn-primary" lay-submit="" lay-filter="searchBtn">
                            <i class="layui-icon layui-icon-search"></i>
                            搜索
                        </a>
                    </div>
                </div>
            </div>
        </form>
    </fieldset>
    <div>
        <table id="AllOrdersTable" lay-filter="AllOrdersTable"></table>
    </div>
</div>

<script id="tool" type="text/html">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="details">详情</a>
    <a class="layui-btn  layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
    <a class="layui-btn  layui-btn-green layui-btn-xs" lay-event="edit">收款</a>
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">发货</a>
    <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="edit">退款</a>

</script>
<script>
    layui.use(['table','form'],function(){
        var table = layui.table,form = layui.form;

        //加载表格
        table.render({
            elem:'#AllOrdersTable',
            height:'full-160',
            page:true,
            toolbar:'#tableBar',
            url:'/system/oc/find',
            cols:[
                [
                {type:'numbers',fixed:'left'},
                {type:'checkbox',fixed:'left'},
                {field:'oCode',title:'订单编号',width:100},
                {field:'photo',title:'用户头像',width:200},
                {field:'name',title:'下单用户'},
                {field:'crateTime',title:'下单时间'},
                {field:'status',title:'订单状态'},
                {field:'money',title:'订单金额'},
                {field:'realPay',title:'实付金额'},
                {field:'payTime',title:'实付时间'},
                {field:'consignee',title:'收货人'},
                {field:'phone',title:'收货电话'},
                {field:'lCode',title:'货流单号'},
                {field:'channel',title:'物流渠道'},
                {field:'right',title:'操作',width:300,align:'center',toolbar:'#tool'},

            ]
            ]
        })

        //监听搜索按钮
        form.on('submit(searchBtn)',function(data){
            var dataForm = data.field;
            table.reload('memberTable',{
                page: {
                    curr:1
                },
                where:{
                    name:dataForm.name,
                    status:0
                }
            })
        })

        //监听表格每一行toolbar按钮
        table.on('tool(memberTable)',function (obj) {
            var event = obj.event;
            if('edit' == event){
                active.dialog(obj.data.id);
            }
        })


    })
</script>
</body>
</html>
